﻿<%@ Page Language="C#" %>
<%@ Import Namespace="Teradata.Client.Provider" %>

<script runat="server">
    protected String[] YorN = { "Yes", "No", "" };
    protected String FULL_NM, BAN, CLOC, CUST_SUB_TYPE, UVERSE_RAAID, IPTV_PACKAGE, IPTV_START_DT,
        RCVR_CNT, DVR_CNT, HSIA_SPEED, HSIA_START_DT, HSIA_STATIC_IP_IND;
    protected String ELU_ID, VOIP_PLAN, VOIP_START_DT, VOIP_LINE_CNT, IPTV_AVAIL_CD, HSIA_AVAIL_CD,
        VOIP_AVAIL_CD, WIRE_CENTER, LUID, DA_CD, ADDRESS, UNIT_ADDR, UNIT_COLOR;
    protected Int32 HD_IND;
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime startTime = DateTime.Now; Trace.Write(System.Reflection.MethodInfo.GetCurrentMethod().Name + " Started");
        getData();
        UNIT_COLOR = Request.QueryString["COLOR"];
        DateTime stopTime = DateTime.Now; TimeSpan duration = stopTime - startTime; Trace.Write(System.Reflection.MethodInfo.GetCurrentMethod().Name + " Ended: " + duration.ToString());
    }

    protected String GetADDR_ID()
    {
        if (Request.QueryString["DATA"] != String.Empty)
        {
            String[] tmpStr;
            tmpStr = Convert.ToString(Request.QueryString["DATA"]).Split(':');
            if (tmpStr[1] != String.Empty)
                ELU_ID = tmpStr[1];
            else
                ELU_ID = "NO QUAL";
            return tmpStr[0];
        }
        else
        {
            return "-1";
        }
    }

    protected void getData()
    {
        DateTime startTime = DateTime.Now; Trace.Write(System.Reflection.MethodInfo.GetCurrentMethod().Name + " Started");

        String SQLPattern = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("..\\SQL\\DetailData.sql"));

        bool bWorkingDisconnected = Convert.ToBoolean(ConfigurationManager.AppSettings["WorkingDisconnected"]);
        if (!bWorkingDisconnected)
        {
            using (TdConnection cn = new TdConnection(ConfigurationManager.ConnectionStrings["TDConnString"].ConnectionString))
            {
                String SQL = String.Format(SQLPattern, GetADDR_ID());
                cn.Open();
                TdCommand cm = new TdCommand(SQL, cn);
                cm.CommandTimeout = 0;
                using (cm)
                {

                    using (TdDataReader dr = cm.ExecuteReader())
                        while (dr.Read())
                        {
                            //ELU_ID = dr.IsDBNull(1) ? "NO QUAL" : dr.GetString(0);
                            FULL_NM = dr.IsDBNull(1) ? "" : dr.GetString(1);
                            BAN = dr.IsDBNull(2) ? "" : dr.GetString(2);
                            CLOC = dr.IsDBNull(3) ? "" : dr.GetString(3);
                            CUST_SUB_TYPE = dr.IsDBNull(4) ? "" : dr.GetString(4);
                            UVERSE_RAAID = dr.IsDBNull(5) ? "" : dr.GetString(5);
                            IPTV_PACKAGE = dr.IsDBNull(6) ? "" : dr.GetString(6);
                            IPTV_START_DT = dr.IsDBNull(7) ? "" : dr.GetDate(7).ToShortDateString();
                            RCVR_CNT = dr.IsDBNull(8) ? "" : dr.GetInt32(8).ToString();
                            DVR_CNT = dr.IsDBNull(9) ? "" : dr.GetInt32(9).ToString();
                            HD_IND = dr.IsDBNull(10) ? 2 : dr.GetInt32(10);
                            HSIA_SPEED = dr.IsDBNull(11) ? "" : dr.GetString(11);
                            HSIA_START_DT = dr.IsDBNull(12) ? "" : dr.GetDate(12).ToShortDateString();
                            HSIA_STATIC_IP_IND = dr.IsDBNull(13) ? "" : dr.GetString(13);
                            VOIP_PLAN = dr.IsDBNull(14) ? "" : dr.GetString(14);
                            VOIP_START_DT = dr.IsDBNull(15) ? "" : dr.GetDate(15).ToShortDateString();
                            VOIP_LINE_CNT = dr.IsDBNull(16) ? "" : dr.GetInt32(16).ToString();
                            IPTV_AVAIL_CD = dr.IsDBNull(17) ? "RED" : dr.GetString(17);
                            HSIA_AVAIL_CD = dr.IsDBNull(18) ? "RED" : dr.GetString(18);
                            VOIP_AVAIL_CD = dr.IsDBNull(19) ? "RED" : dr.GetString(19);
                            WIRE_CENTER = dr.IsDBNull(20) ? "" : dr.GetString(20);
                            LUID = dr.IsDBNull(21) ? "" : dr.GetString(21);
                            DA_CD = dr.IsDBNull(22) ? "" : dr.GetString(22);
                            ADDRESS = dr.IsDBNull(23) ? "" : dr.GetString(23);
                            UNIT_ADDR = dr.IsDBNull(24) ? "" : dr.GetString(24);
                        }
                }
            }
        }
        DateTime stopTime = DateTime.Now; TimeSpan duration = stopTime - startTime; Trace.Write(System.Reflection.MethodInfo.GetCurrentMethod().Name + " Ended: " + duration.ToString());
    }
    
</script>
<center>
    <div style="text-align: left">
    <center><h4><font color="<%=UNIT_COLOR%>" style="position:relative;top:20px;left:20px"><%=UNIT_ADDR%></font></h4></center>
        <fieldset>
            <legend>ACCOUNT DATA</legend>
            <table style="width: 100%; padding-left: 1%;">
                <tr>
                    <td>
                        <font color="white" style="float:right; padding-right: 25px">
                            <%=UVERSE_RAAID%></font><b>RAAID: </b>
                    </td>
                    <td>
                        <b>Name: </b><font color="white" style=" padding-left: 10px">
                            <%=FULL_NM %></font>
                    </td>
                </tr>
                <tr>
                    <td>
                       <font color="white" style="float:right; padding-right: 25px">
                            <%=BAN %></font> <b>BAN: </b>
                    </td>
                    <td rowspan="3" valign="top"><b>Address:</b>
                        <font color="white" style="margin-left: 25px"><%=ADDRESS %></font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font color="white" style="float:right; padding-right: 25px">
                            <%=CLOC %></font><b>CLOC: </b>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font color="white" style="float:right; padding-right: 25px">
                            <%=ELU_ID %></font><b>ELU_ID: </b>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font color="white" style="float:right; padding-right: 25px">
                            <%=CUST_SUB_TYPE%></font><b>TYPE: </b>
                    </td>
                    <td>
                        <table cellpadding="0" cellspacing="0" style="width: 100%">
                            <tr>
                                <td>
                                    <b>WIRE CTR: </b><font color="white">
                                        <%=WIRE_CENTER%></font>
                                </td>
                                <td>
                                    <b>LUID: </b><font color="white" face="Courier New" size="2">
                                        <%=LUID%></font>
                                </td>
                                <td>
                                   <b>DA CD: </b><font color="white" >
                                        <%=DA_CD%></font> 
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </fieldset>
        <fieldset>
            <legend>UVERSE</legend>
            <table width="100%">
                <tr>
                    <td valign="top" width="33%">
                        <fieldset>
                            <legend>IPTV</legend>
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=IPTV_PACKAGE%></font><b>Package: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=IPTV_START_DT%></font><b>Start Date: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                       <font color="white" style="float:right; padding-right: 10px">
                                            <%=YorN[HD_IND] %></font><b>High Def: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=RCVR_CNT%></font> (<font color="white"><%=DVR_CNT%></font>)<b>Rcvr (DVR) Count: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=IPTV_AVAIL_CD%></font><b>ELIGIBILITY: </b></td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                    <td valign="top" width="34%">
                        <fieldset>
                            <legend>HSIA</legend>
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                       <font color="white" style="float:right; padding-right: 10px">
                                            <%=HSIA_SPEED%></font> <b>Speed: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                       <font color="white" style="float:right; padding-right: 10px">
                                            <%=HSIA_START_DT%></font> <b>Start Date: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=HSIA_STATIC_IP_IND%></font><b>Static IP: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>&nbsp;</b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=HSIA_AVAIL_CD%></font><b>ELIGIBILITY: </b></td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                    <td valign="top" width="33%">
                        <fieldset>
                            <legend>VOIP</legend>
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=VOIP_PLAN%></font><b>Plan: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=VOIP_START_DT%></font><b>Start Date: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=VOIP_LINE_CNT%></font><b>Line Count: </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>&nbsp;</b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <font color="white" style="float:right; padding-right: 10px">
                                            <%=VOIP_AVAIL_CD%></font><b>ELIGIBILITY: </b></td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>
</center>
<!--  <fieldset><legend>WIRELESS</legend>
     <table style="width:70%;padding-left:10%;">
     <tr><td><b>RAAID: </b></td></tr>
     <tr><td><b>Handset Count: </b></td></tr>
     </table>
   </fieldset>
   <fieldset><legend>TELCO</legend>
     <table style="width:70%;padding-left:10%;">
     <tr><td><b>RAAID </b></td><td><b>DSL Speed: </b></td></tr>
     <tr><td><b>BTN: </b></td></tr>
     </table>
   </fieldset>-->
